package com.doordu.framework.cloud.xxl;

import com.doordu.framework.cloud.xxl.enums.HandlerTypeEnums;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author zxw
 * @date 2020/9/21 13:38
 */
@ConfigurationProperties(DoorduJobInstanceConfigBean.PREFIX)
@Configuration
public class DoorduJobInstanceConfigBean implements DoorduJobInstanceConfig {
    public static final String PREFIX = "doordu.job";
    public static final String DEFAULT_LOG_PATH = "/data/applogs/xxl-job/jobhandler";
    public static final String DEFAULT_ADDRESS = "http://127.0.0.1:9999";
    public static final String UNKNOWN = "unknown";
    public static final String HANDLER_TYPE = HandlerTypeEnums.METHOD_HANDLER.getName();

    private String adminAddresses;
    private String accessToken;
    private String appname = UNKNOWN;
    private String address;
    private String ip;
    private int port;
    private String logPath;
    private int logRetentionDays;
    private String handlerType;
    private boolean enable = false;

    @Override
    public String getAppName() {
        return appname;
    }

    @Override
    public String getAddress() {
        return address;
    }

    @Override
    public int getPort() {
        return port;
    }

    @Override
    public String getAccessToken() {
        return accessToken;
    }

    @Override
    public String getHost() {
        return ip;
    }

    @Override
    public String getHandlerName() {
        return handlerType;
    }

    public String getAdminAddresses() {
        return adminAddresses;
    }

    public void setAdminAddresses(String adminAddresses) {
        this.adminAddresses = adminAddresses;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getAppname() {
        return appname;
    }

    public void setAppname(String appname) {
        this.appname = appname;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getLogPath() {
        return logPath;
    }

    public void setLogPath(String logPath) {
        this.logPath = logPath;
    }

    public int getLogRetentionDays() {
        return logRetentionDays;
    }

    public void setLogRetentionDays(int logRetentionDays) {
        this.logRetentionDays = logRetentionDays;
    }

    public String getHandlerType() {
        return handlerType;
    }

    public void setHandlerType(String handlerType) {
        this.handlerType = handlerType;
    }
}
